package myky.com.doctorapp.model;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import myky.com.doctorapp.api.ApiManager;
import myky.com.doctorapp.entity.AuthorListEntity;
import myky.com.doctorapp.base.BaseEntity;
import myky.com.doctorapp.contract.AuthorListActivityContract;
import myky.com.doctorapp.utils.RequestBodyBuilder;
import okhttp3.RequestBody;

public class AuthorListActivityModel implements AuthorListActivityContract.Model {
    @Override
    public Observable<BaseEntity<List<AuthorListEntity.DataBean>>> getAuthorList(String version) {
        RequestBodyBuilder.Builder builder = new RequestBodyBuilder.Builder();
        RequestBody requestBody = builder
                .params("version",version)
                .params("current",1+"")
                .params("size",10+"")
                .build();

        return ApiManager.getApistore().authorListApi(requestBody).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
